package CuratorCtrl;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.util.Vector;

import javax.swing.JButton;
import javax.swing.JPanel;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class MainFrame extends javax.swing.JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1460745288288780004L;
	private JPanel jPanel1;
	private JButton bu_import;
	private JButton jButton3;
	private JButton bu_manage;
	public static Vector<Image> imagelist=new Vector<Image>();
	public static String[] namelist;


	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				MainFrame inst = new MainFrame();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public MainFrame() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{	
				jPanel1 = new JPanel();
				getContentPane().add(jPanel1, BorderLayout.CENTER);
				jPanel1.setPreferredSize(new java.awt.Dimension(391, 100));
				{
					bu_import = new JButton();
					jPanel1.add(bu_import);
					bu_import.setText("Import");
					bu_import.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							bu_importActionPerformed(evt);
						}
					});
				}
				{
					bu_manage = new JButton();
					jPanel1.add(bu_manage);
					bu_manage.setText("Manage/use");
					bu_manage.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							bu_manageActionPerformed(evt);
						}
					});
				}
				{
					jButton3 = new JButton();
					jPanel1.add(jButton3);
					jButton3.setText("EXIT");
					jButton3.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							jButton3ActionPerformed(evt);
						}
					});
				}
			}
			pack();
			this.setSize(411, 80);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	private void bu_importActionPerformed(ActionEvent evt) {
		System.out.println("bu_import.actionPerformed, event="+evt);
		ImportInterface ii=new ImportInterface();
		//TODO add your code for bu_import.actionPerformed
		ii.setLocationRelativeTo(null);
		ii.addWindowListener(new java.awt.event.WindowAdapter() {
	        public void windowClosing(WindowEvent winEvt) {
	           unlock();
	        }
	    });
		ii.setVisible(true);
		lock();
	}
	
	private void bu_manageActionPerformed(ActionEvent evt) {
		System.out.println("bu_manage.actionPerformed, event="+evt);
		//TODO add your code for bu_manage.actionPerformed
		ManageInterface mi=new ManageInterface();
		mi.addWindowListener(new java.awt.event.WindowAdapter() {
	        public void windowClosing(WindowEvent winEvt) {
	           unlock();
	        }
	    });
		mi.setLocationRelativeTo(null);
		mi.setVisible(true);	
		lock();
	}

	public void lock(){
		bu_import.setEnabled(false);
		bu_manage.setEnabled(false);

	}
	public void unlock(){
		bu_import.setEnabled(true);
		bu_manage.setEnabled(true);
	}
	
	private void jButton3ActionPerformed(ActionEvent evt) {
		System.out.println("jButton3.actionPerformed, event="+evt);
        System.exit(0);

		//TODO add your code for jButton3.actionPerformed
	}

}
